<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Velg oppgave for endring</title>
        <h:outputStylesheet library="css" name="default.css"/>
    </h:head>
    <h:body>
        <ui:composition template="/templates/template.xhtml">
            <ui:define name="content">
                <p:growl id="growl" globalOnly="true" sticky="False" />
                <h:form>
                    <div align="center"> 
                        <h2>#{tekster.RO_oppgave}</h2>
                        <p:panelGrid> 
                            <f:facet name="header">
                                <p:row>
                                    <p:column> #{tekster.Velg_kl} </p:column>
                                    <p:column> #{tekster.Velg_op} </p:column>
                                    <p:column> #{tekster.Velg_niv} </p:column>
                                    <p:column> #{tekster.RO_oppgave}</p:column>
                                </p:row>
                            </f:facet>
                            <f:facet name="header">
                                <p:row>
                                    <p:column styleClass="columclass">
                                        <p:selectOneListbox id="klasse" requiredMessage="#{tekster.Du_maa_velge_klasse}" required="true" converterMessage="Converter failed" converter="#{klasseConverter}" value="#{reg.k}" styleClass="oddColumn" >
                                            <f:selectItems value="#{reg.klasser}" 
                                                           var="klasse"
                                                           itemLabel="#{klasse.toString()}"
                                                           itemValue="#{klasse}"/> 
                                            <f:ajax event="valueChange" execute="@this" render="operator oppgavesett oppgave"/>
                                        </p:selectOneListbox>
                                        <p:message for="klasse"/>
                                    </p:column>
                                    <p:column styleClass="columclass">

                                        <p:selectOneListbox id="operator" requiredMessage="#{tekster.Du_maa_velge_operator}" required="true" value="#{reg.operator}" styleClass="oddColumn">
                                            <f:selectItem itemValue="+" itemLabel="+"/>
                                            <f:selectItem itemValue="-" itemLabel="-"/>
                                            <f:selectItem itemValue="/" itemLabel="/"/>
                                            <f:selectItem itemValue="*" itemLabel="*"/>
                                            <f:ajax event="valueChange" execute="@this" render="oppgavesett oppgave"/>
                                        </p:selectOneListbox>
                                        <p:message for="operator"/>
                                    </p:column>
                                    <p:column styleClass="columclass">
                                        <p:selectOneListbox id="oppgavesett" value="#{reg.os}" converter="#{oppgaveSettConverter}" styleClass="oddColumn">
                                            <f:selectItems value="#{reg.opgs}"                                               
                                                           var="nivaa"
                                                           itemLabel="#{nivaa.toString()}"
                                                           itemValue="#{nivaa}"/>
                                            <f:ajax event="valueChange" execute="@this" render="oppgave"/>
                                        </p:selectOneListbox>
                                    </p:column>
                                    <p:column styleClass="columclass">
                                        <p:selectOneListbox id="oppgave" converter="#{oppgaveConverter}" converterMessage="Feil i oppgaveConverter" styleClass="oddColumn" value="#{reg.oppg}">
                                            <f:selectItems value="#{reg.oppgaver}" var="oppg" itemLabel="#{oppg.toString()}" itemValue="#{oppg}"/>
                                        </p:selectOneListbox>
                                    </p:column>
                                </p:row>
                            </f:facet>
                        </p:panelGrid>
                        <br/>
                        <p:commandButton  update="growl" ajax="false" value="#{tekster.Opprett_OK}" action="#{reg.redirect(e)}"/>
                    </div>
                </h:form>
            </ui:define>
             <ui:define name="left">
                <div align="center">
                    <h:commandLink action="/index?faces-redirect=true" immediate="true">
                        <h:graphicImage library="images" name="home.png"/>
                    </h:commandLink><br/><br/>
                    <p:commandButton ajax="false" action="/Ansatt/ansatt?faces-redirect=true" value="#{tekster.Tilbake_ansatt}" immediate="true" />
                </div>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

